#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QFileDialog>
#include <QMessageBox>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    ui->actionOpen->setIconVisibleInMenu(true);
    ui->actionSave->setIconVisibleInMenu(true);
    ui->actionQuit->setIconVisibleInMenu(true);
    //this->showMaximized();
    Controller = new MainController(this);

    // Connect all actions to the Controller.
    connect(ui->actionQuit, SIGNAL(triggered()), Controller, SLOT(on_actionQuit_triggered()));
    connect(ui->actionOpen, SIGNAL(triggered()), Controller, SLOT(on_actionOpen_triggered()));
    connect(ui->actionSave, SIGNAL(triggered()), Controller, SLOT(on_actionSave_triggered()));
    connect(ui->actionSaveAs, SIGNAL(triggered()), Controller, SLOT(on_actionSaveAs_triggered()));
    connect(ui->actionColors, SIGNAL(triggered()), Controller, SLOT(on_actionExampleProcessor_triggered()));
    connect(ui->btnPreviewProcessor, SIGNAL(clicked()), Controller, SLOT(on_btnPreviewProcessor_clicked()));
    connect(ui->actionNegative, SIGNAL(triggered()), Controller, SLOT(on_actionNegative_triggered()));
    connect(ui->actionBrightness, SIGNAL(triggered()), Controller, SLOT(on_actionBrightness_triggered()));
    connect(ui->btnApply, SIGNAL(clicked()), Controller, SLOT(on_btnApply_clicked()));
    connect(ui->btnReset, SIGNAL(clicked()), Controller, SLOT(on_btnReset_clicked()));
    connect(ui->actionFlip, SIGNAL(triggered()), Controller, SLOT(on_actionFlip_triggered()));
    connect(ui->actionGrayscale, SIGNAL(triggered()), Controller, SLOT(on_actionGrayscale_triggered()));
    connect(ui->actionAbout, SIGNAL(triggered()), Controller, SLOT(on_actionAbout_triggered()));
}

MainWindow::~MainWindow()
{
    delete ui;
}
